package ${package};

import java.util.Date;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.beetl.sql.core.annotatoin.ColumnIgnore;
import org.beetl.sql.core.annotatoin.AutoID;
import org.beetl.sql.core.annotatoin.SeqID;
import org.apache.commons.lang3.StringUtils;
import com.ibeetl.admin.core.util.ValidateConfig;
import com.sdx.service.ConfigService;

import org.beetl.sql.core.TailBean;
import java.math.*;

import com.ibeetl.admin.core.annotation.Dict;
import com.ibeetl.admin.core.entity.BaseEntity;

import org.beetl.sql.core.annotatoin.InsertIgnore;
import org.beetl.sql.core.annotatoin.Version;
import org.beetl.sql.core.annotatoin.LogicDelete;
import com.sdx.common.utils.Utils;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;

/* 
* ${comment}
* gen by Spring Boot2 Admin ${date(),"yyyy-MM-dd"}
*/
\@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
\@Data
public class ${className} extends BaseEntity{

    @for(attr in attrs){
		@if(!isEmpty(attr.comment)){
    //${attr.comment}
		@}
		@if(attr.isId) {
    \@NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class)
    \@AutoID	
		@}
		@if(isNotEmpty(attr.dictType)) {
    \@Dict(type="${attr.dictType}")
		@}
		@if(attr.name == "delFlag") {
	/*逻辑删除标志*/
	\@InsertIgnore
	\@LogicDelete(value = 1)
		@}
		@if(attr.name == "version") {
	/*乐观锁版本标志*/
	\@InsertIgnore
	\@Version
		@}
    private ${attr.type} ${attr.name} ;
	
	@}
    @for(attr in attrs){
        @if(attr.elementType==7) {
	public ${attr.type} get${attr.methodName}View(){
		return Utils.imageUrl(${attr.name});
	}
		@} else if (attr.elementType>7 && attr.elementType<20) {
	public ${attr.type} get${attr.methodName}Link(){
		return Utils.imageUrl(${attr.name});
	}
		@}
    @}
	@for(attr in queryDates){
	\@ColumnIgnore
	\@JsonIgnore
	private String ${attr.name}Query;
	\@ColumnIgnore
	\@JsonIgnore
	private Date ${attr.name}Start;
	\@ColumnIgnore
	\@JsonIgnore
	private Date ${attr.name}End;
	public String get${upperFirst(attr.name)}Query(){
		return  ${attr.name}Query;
	}
	public void set${upperFirst(attr.name)}Query(String ${attr.name}Query ){
		this.${attr.name}Query = ${attr.name}Query;
		Date[] timePair = Utils.parseQueryTime(${attr.name}Query);
		if (timePair!=null && timePair[0]!=null) {
			this.${attr.name}Start = timePair[0];
		}
		if (timePair!=null && timePair.length==2 && timePair[1]!=null) {
			this.${attr.name}End = timePair[1];
		}

	}
	public Date get${upperFirst(attr.name)}Start(){
		return  ${attr.name}Start;
	}
	public void set${upperFirst(attr.name)}Start(Date ${attr.name}Start ){
		this.${attr.name}Start = ${attr.name}Start;
	}
	public Date get${upperFirst(attr.name)}End(){
		return  ${attr.name}End;
	}
	public void set${upperFirst(attr.name)}End(Date ${attr.name}End ){
		this.${attr.name}End = ${attr.name}End;
	}
    @}

}
